﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp9
{
    class Program
    {
        static void Main(string[] args)
        {
            Stack test = new Stack();
            //增加元素
            test.Push("乔治");
            test.Push("佩奇");
            test.Push("小猪");
            test.Pop();
            //判断栈中是否有元素
            while (test.Count != 0)
            {
                Console.WriteLine(test.Pop()); 
            }
            Console.WriteLine();



            /*//复制 Stack 到一个新的数组中
            object[] arr = test.ToArray();
            foreach (var h in test)
            {
                Console.WriteLine(h);
            }*/
            //移除栈顶元素
           /* while(test.Count != 0)
            {
                Console.WriteLine(test.Pop ());
            }*/
        }
    }
}
